using System;
using System.Data;
using System.Data.SqlClient;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Csla;

namespace Model
{
    [Serializable()]
    public class StrStrBOList : Csla.NameValueListBase<string, string>
    {
        #region Factory Methods
        private StrStrBOList()
        {
        }

        public void InsertCustomValue(string customKey, string customValue)
        {
            IsReadOnly = false;
            this.Insert(0, new NameValuePair(customKey, customValue));
            IsReadOnly = true;
        }

        public void InsertCustomValue(int index, string customKey, string customValue)
        {
            IsReadOnly = false;
            this.Insert(index, new NameValuePair(customKey, customValue));
            IsReadOnly = true;
        }

        public void AddCustomValue(string customKey, string customValue)
        {
            IsReadOnly = false;
            this.Add(new NameValuePair(customKey, customValue));
            IsReadOnly = true;
        }

        public void CleaAll()
        {
            IsReadOnly = false;
            this.ClearItems();
            IsReadOnly = true;
        }

        private static StrStrBOList _list;

        public static StrStrBOList NewStrStrBOList()
        {
            _list = DataPortal.Fetch<StrStrBOList>(null);
            return _list;
        }

        public static void InvalidateCache()
        {
            _list = null;
        }
        #endregion Factory Methods
        //==========================================================================

        #region Data Access
        protected override void DataPortal_Fetch(object _spParam)
        {
        }
        #endregion Data Access
        //==========================================================================
    }
}
